#include <iostream>
#include "detect/include/Det_darknet.h"

using namespace alg;

int main() {
    string json_path = "../config.json";
    alg::Config::instance().parse_config(json_path);

    cv::VideoCapture capture;
    capture.open("../data/test1.avi");
    Mat frame;
    capture>>frame;
    DarknetDet det(frame.cols,frame.rows);
    vector<DetObjectStr> det_result;
    while(1){
        capture>>frame;
        Mat dst = frame.clone();
        if(frame.empty())break;
        det.detect(frame.data,det_result);
        for(auto o:det_result) {
            cout << o.label << endl;
            cv::rectangle(dst, o.rect, Scalar(255, 0, 0), 2);
        }
        det_result.clear();
        cv::imshow("dst",dst);
        cv::waitKey(10);
    }
    std::cout << "Hello, World!" << std::endl;
    return 0;
}